/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.yogi.webframework.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Yogi
 */
@Entity
@Table(name = "t_order")
@NamedQueries({
    @NamedQuery(name = "Ordo.findAll", query = "SELECT o FROM Ordo o"),
    @NamedQuery(name = "Ordo.findById", query = "SELECT o FROM Ordo o WHERE o.id = :id"),
    @NamedQuery(name = "Ordo.findByOrderdate", query = "SELECT o FROM Ordo o WHERE o.orderdate = :orderdate"),
    @NamedQuery(name = "Ordo.findByName", query = "SELECT o FROM Ordo o WHERE o.name = :name"),
    @NamedQuery(name = "Ordo.findByEmail", query = "SELECT o FROM Ordo o WHERE o.email = :email"),
    @NamedQuery(name = "Ordo.findByPhone", query = "SELECT o FROM Ordo o WHERE o.phone = :phone"),
    @NamedQuery(name = "Ordo.findByAddress", query = "SELECT o FROM Ordo o WHERE o.address = :address"),
    @NamedQuery(name = "Ordo.findByReceiver", query = "SELECT o FROM Ordo o WHERE o.receiver = :receiver"),
    @NamedQuery(name = "Ordo.findByZipcode", query = "SELECT o FROM Ordo o WHERE o.zipcode = :zipcode"),
    @NamedQuery(name = "Ordo.findByCountry", query = "SELECT o FROM Ordo o WHERE o.country = :country"),
    @NamedQuery(name = "Ordo.findByShoesSize", query = "SELECT o FROM Ordo o WHERE o.shoesSize = :shoesSize"),
    @NamedQuery(name = "Ordo.findByShoesImageSrc", query = "SELECT o FROM Ordo o WHERE o.shoesImageSrc = :shoesImageSrc"),
    @NamedQuery(name = "Ordo.findByShoesPrice", query = "SELECT o FROM Ordo o WHERE o.shoesPrice = :shoesPrice")})
public class Ordo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "ORDERDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderdate;
    @Column(name = "NAME")
    private String name;
    @Column(name = "EMAIL")
    private String email;
    @Column(name = "PHONE")
    private String phone;
    @Column(name = "ADDRESS")
    private String address;
    @Column(name = "RECEIVER")
    private String receiver;
    @Column(name = "ZIPCODE")
    private String zipcode;
    @Column(name = "COUNTRY")
    private String country;
    @Column(name = "SHOES_SIZE")
    private Integer shoesSize;
    @Column(name = "SHOES_IMAGE_SRC")
    private String shoesImageSrc;
    @Column(name = "SHOES_PRICE")
    private Float shoesPrice;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ordo")
    private List<OrdoDetail> ordoDetailList;
    @JoinColumn(name = "T_ORDER_STATUS_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private OrdoStatus ordoStatus;
    @JoinColumn(name = "T_PRODUCT_ID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Product product;

    public Ordo() {
    }

    public Ordo(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getOrderdate() {
        return orderdate;
    }

    public void setOrderdate(Date orderdate) {
        this.orderdate = orderdate;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public Integer getShoesSize() {
        return shoesSize;
    }

    public void setShoesSize(Integer shoesSize) {
        this.shoesSize = shoesSize;
    }

    public String getShoesImageSrc() {
        return shoesImageSrc;
    }

    public void setShoesImageSrc(String shoesImageSrc) {
        this.shoesImageSrc = shoesImageSrc;
    }

    public Float getShoesPrice() {
        return shoesPrice;
    }

    public void setShoesPrice(Float shoesPrice) {
        this.shoesPrice = shoesPrice;
    }

    public List<OrdoDetail> getOrdoDetailList() {
        return ordoDetailList;
    }

    public void setOrdoDetailList(List<OrdoDetail> ordoDetailList) {
        this.ordoDetailList = ordoDetailList;
    }

    public OrdoStatus getOrdoStatus() {
        return ordoStatus;
    }

    public void setOrdoStatus(OrdoStatus ordoStatus) {
        this.ordoStatus = ordoStatus;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ordo)) {
            return false;
        }
        Ordo other = (Ordo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.yogi.webframework.model.Ordo[id=" + id + "]";
    }

}
